//
//  UICLController+Back.m
//  clzg_ios
//
//  Created by macpro on 16/5/20.
//  Copyright © 2016年 macpro. All rights reserved.
//

#import "UIViewController+Back.h"
//#import "UserCenterController.h"
//#import "SearchController.h"

@implementation UIViewController(Back)



-(void)showBack{
    // 更改左按键样式,并设置navigationBar.barTintColor
    if (self.navigationController) {
        // 自定义左键，贴图，并重写返回方法
        UIButton *leftBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        leftBtn.frame = CGRectMake(0, 0, 30, 30);
        [leftBtn setImage:[UIImage imageNamed:@"contenttoolbar_hd_back"] forState:UIControlStateNormal];
        [leftBtn addTarget:self action:@selector(leftBtnClick) forControlEvents:UIControlEventTouchUpInside];
        self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:leftBtn];
        //self.navigationController.navigationBar.barTintColor = theme_color;
        
    }
}

/**
 * 重新实现左按键返回方法
 */
- (void)leftBtnClick
{
    if (self.navigationController) {
        [self.navigationController popViewControllerAnimated:YES];
    }
}

@end
